use BGT_2007_2010_2012_withvars_021716_mechanisms.dta, clear
drop if inlist(statefip,2,15)

xtset panelid year
replace sumsample=1 if F2.sumsample==1 

tempfile a
save `a', replace
gen dataset=1
append using `a'
replace dataset=2 if dataset==.

gen double yearstr=year if dataset==1
replace yearstr=20072010 if dataset==2 & year==2010
replace yearstr=20102012 if dataset==2 & year==2012


#delimit;

foreach var of varlist  totalopenings neednoedu needhs needsc needbd needgd needbd_plus 
needna need0to2  need2to4  need4to7 need7to15 need4  { ;

	if "`var'"=="totalopenings" { ;
		replace `var'=dto if dataset==2;
	};
	else {;
		replace `var'=d`var' if dataset==2;
	};
};
#delimit cr
replace s_unemprate=du if dataset==2
replace s_unemprate_bd=dubd if dataset==2
replace s_unemprate_35plus=du35plus if dataset==2
replace HWOLsupdemrate_occsoc_broad=dHWOLsupdemratebroad if dataset==2
replace BGTsupdemrate_occsoc_broad=dBGTsupdemratebroad if dataset==2

gen sample=1 if (sumsample==1 & dataset==1) | (estsample==1 & dataset==2)

latabstat totalopenings if sample==1, by(yearstr) statistics(mean sd) col(stat) nototal f(%9.2fc) 

latabstat neednoedu needhs needsc needbd needgd needbd_plus if sample==1, by(yearstr) statistics(mean) col(var) nototal f(%9.2fc)

latabstat needna need0to2  need2to4  need4to7 need7to15 need4 if sample==1, by(yearstr) statistics(mean) col(var) nototal f(%9.2fc)

latabstat s_unemprate if sample==1, by(yearstr) statistics(mean sd) col(stat) nototal f(%9.2fc) 

latabstat s_unemprate_bd  s_unemprate_35plus if sample==1, by(yearstr) statistics(mean) col(var) nototal f(%9.2fc) 
latabstat HWOLsupdemrate_occsoc_broad  BGTsupdemrate_occsoc_broad if sample==1, by(yearstr) statistics(mean) col(var) nototal f(%9.2fc) 

latabstat totalopenings if sample==1, by(yearstr) statistics(N) col(stat) nototal f(%9.2fc) 


